
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    
<head>  

    <script type="text/javascript" src="http://c.csdnimg.cn/pubfooter/js/tracking.js" charset="utf-8"></script>  

    <script type="text/javascript">
        var protocol = window.location.protocol;
        document.write('<script type="text/javascript" src="' + protocol + '//csdnimg.cn/pubfooter/js/repoAddr2.js?v=' + Math.random() + '"></' + 'script>');
    </script>

  
 <meta http-equiv="Cache-Control" content="no-siteapp" /><link rel="alternate" media="handheld" href="#" />

    <title>串口通信-MSComm控件使用详解 - dongyue786的专栏
        - 博客频道 - CSDN.NET</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="MSComm 控件通过串行端口传输和接收数据，为应用程序提供串行通讯功能。MSComm控件在串口编程时非常方便，程序员不必去花时间去了解较为复杂的API函数，而且在VC、VB、Delphi等语言中均可使用。&#160;Microsoft Communications Control（以下简称MSComm）是Microsoft公司提供的简化Windows下串行通信编程的ActiveX控件，它为应用程序提供了通" />
    <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script>
      <script type="text/javascript" src="http://static.blog.csdn.net/scripts/jquery-version.js"></script>
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/ad.js?v=1.1"></script>
        <!--new top-->
               <link rel="stylesheet" href="http://c.csdnimg.cn/public/common/toolbar/css/index.css">        <!--new top-->
    
      <!-- ad begin -->
         <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/tracking.js"></script>
    <!-- ad end-->

    <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/default/css/style.css?v=1.1" />
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="/dongyue786/rss/list" />
    <link rel="shortcut icon" href="http://c.csdnimg.cn/public/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" />
 


<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?6bcd52f51e9b3dce32bec4a3997715ac";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

</head>
<body>


    <!-- 广告位开始 -->
        <ins data-revive-zoneid="149" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
    <!-- 广告位结束 -->

    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="http://c.csdnimg.cn/public/common/toolbar/js/html.js" type="text/javascript"></script>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/dongyue786">dongyue786的专栏</a></h2>
            <h3></h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
        
     
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>           
                <li id="btnContents"><a href="http://blog.csdn.net/dongyue786?viewmode=contents"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_mulu'])">
                    <img src="http://static.blog.csdn.net/images/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/dongyue786?viewmode=list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_zhaiyao'])">
                    <img src="http://static.blog.csdn.net/images/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/dongyue786/rss/list"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])">
                    <img src="http://static.blog.csdn.net/images/ico_rss.gif">订阅</span></a></li>                
            

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "dongyue786";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/dongyue786";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod='popu_3' > 


<a href="http://blog.csdn.net/blogdevteam/article/details/61435419">
<font color=red> CSDN日报20170311——《程序员每天累成狗，是为了什么》</font></a>

&nbsp;&nbsp;&nbsp;&nbsp

<a href="http://blog.csdn.net/turingbooks/article/details/58072986">
<font color=blue>程序员2月书讯
</font></a>

&nbsp;&nbsp;&nbsp;

<a href="http://edu.csdn.net/huiyiCourse/detail/284?ref=blog&loc=r3">
<font color=red>【直播】用面向协议的思想简化网络请求
</font></a>
&nbsp;&nbsp;&nbsp;

<a href="http://blog.csdn.net/blogdevteam/article/details/60961185">
<font color=blue>博客一键搬家活动开始啦
</font></a>

</div>                        </div>
                        



  
<link href="http://static.blog.csdn.net/css/comment1.css" type="text/css" rel="stylesheet" />
<link href="http://static.blog.csdn.net/css/style1.css" type="text/css" rel="stylesheet" />
<script language='JavaScript' type='text/javascript' src='http://download.csdn.net/js/jquery.cookie.js'></script>
<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/search-service/main.js"></script>
<link rel="stylesheet" href="http://static.blog.csdn.net/public/res-min/markdown_views.css?v=1.0" />
<link rel="stylesheet" href="http://static.blog.csdn.net/css/category.css?v=1.0" />
<script type="text/javascript" src="http://static.blog.csdn.net/public/res/bower-libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/web-storage-cache.min.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/replace.min.js"></script>




  <script type="text/ecmascript">
      window.quickReplyflag = true;
           
            var isBole = false;
            
      
      var fasrc="http://my.csdn.net/my/favorite/miniadd?t=%e4%b8%b2%e5%8f%a3%e9%80%9a%e4%bf%a1-MSComm%e6%8e%a7%e4%bb%b6%e4%bd%bf%e7%94%a8%e8%af%a6%e8%a7%a3&u=http://blog.csdn.net/dongyue786/article/details/8177047"

    </script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Repost"></span>


    <h1>
        <span class="link_title"><a href="/dongyue786/article/details/8177047">
        串口通信-MSComm控件使用详解            
        </a></span>
    </h1>
</div>

   

        <div class="article_manage clearfix">
        <div class="article_r">
            <span class="link_postdate">2012-11-13 09:35</span>
            <span class="link_view" title="阅读次数">15007人阅读</span>
            <span class="link_comments" title="评论次数"> <a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(0)</span>
            <span class="link_collect tracking-ad" data-mod="popu_171"> <a href="javascript:void(0);" onclick="javascript:collectArticle('%e4%b8%b2%e5%8f%a3%e9%80%9a%e4%bf%a1-MSComm%e6%8e%a7%e4%bb%b6%e4%bd%bf%e7%94%a8%e8%af%a6%e8%a7%a3','8177047');return false;" title="收藏">收藏</a></span>
             <span class="link_report"> <a href="#report" onclick="javascript:report(8177047,2);return false;" title="举报">举报</a></span>

        </div>
    </div>
    <div class="embody"  style="display:none" id="embody">
        <span class="embody_t">本文章已收录于：</span>
        <div class="embody_c" id="lib" value="{&quot;err&quot;:0,&quot;msg&quot;:&quot;ok&quot;,&quot;data&quot;:[]}"></div>
    </div>
    <style type="text/css">        
            .embody{
                padding:10px 10px 10px;
                margin:0 -20px;
                border-bottom:solid 1px #ededed;                
            }
            .embody_b{
                margin:0 ;
                padding:10px 0;
            }
            .embody .embody_t,.embody .embody_c{
                display: inline-block;
                margin-right:10px;
            }
            .embody_t{
                font-size: 12px;
                color:#999;
            }
            .embody_c{
                font-size: 12px;
            }
            .embody_c img,.embody_c em{
                display: inline-block;
                vertical-align: middle;               
            }
             .embody_c img{               
                width:30px;
                height:30px;
            }
            .embody_c em{
                margin: 0 20px 0 10px;
                color:#333;
                font-style: normal;
            }
    </style>
    <script  type="text/javascript">
        $(function () {
            try
            {
                var lib = eval("("+$("#lib").attr("value")+")");
                var html = "";
                if (lib.err == 0) {
                    $.each(lib.data, function (i) {
                        var obj = lib.data[i];
                        //html += '<img src="' + obj.logo + '"/>' + obj.name + "&nbsp;&nbsp;";
                        html += ' <a href="' + obj.url + '" target="_blank">';
                        html += ' <img src="' + obj.logo + '">';
                        html += ' <em><b>' + obj.name + '</b></em>';
                        html += ' </a>';
                    });
                    if (html != "") {
                        setTimeout(function () {
                            $("#lib").html(html);                      
                            $("#embody").show();
                        }, 100);
                    }
                }      
            } catch (err)
            { }
            
        });
    </script>
      <div class="category clearfix">
        <div class="category_l">
           <img src="http://static.blog.csdn.net/images/category_icon.jpg">
            <span>分类：</span>
        </div>
        <div class="category_r">
                    <label>
                        <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">控件编程<em></em></span>                       
                    </label>      
                    <label  onclick="GetCategoryArticles('1194360','dongyue786','top','8177047');">
                        <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">Delphi编程<em>（13）</em></span>
                      <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;">
                      <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;">
                        <div class="subItem">
                            <div class="subItem_t"><a  href="http://blog.csdn.net/dongyue786/article/category/1194360"  target="_blank">作者同类文章</a><i class="J_close">X</i></div>
                            <ul class="subItem_l" id="top_1194360">                            
                            </ul>
                        </div>
                    </label>                    
        </div>
    </div>
    <script   type="text/javascript" src="http://static.blog.csdn.net/scripts/category.js"></script>  

  

  
  
     

<div id="article_content" class="article_content">

<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px; background-color:rgb(255,255,255)">&nbsp;MSComm 控件通过串行端口传输和接收数据，为应用程序提供串行通讯功能。MSComm控件在串口编程时非常方便，程序员不必去花时间去了解较为复杂的API函数，而且在VC、VB、Delphi等语言中均可使用。<span size="-1">&nbsp;</span>Microsoft Communications Control（以下简称MSComm）是Microsoft公司提供的简化Windows下串行通信编程的ActiveX控件，它为应用程序提供了通过串行接口收发数据的简便方法。具体的来说，它提供了两种处理通信问题的方法：一是事件驱动(Event－driven)方法，一是查询法。</span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px">1.MSComm控件两种处理通讯的方式&nbsp;</span></span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px; background-color:rgb(255,255,255)">1.1 事件驱动方式</span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px; background-color:rgb(255,255,255)">事件驱动通讯是处理串行端口交互作用的一种非常有效的方法。在许多情况下，在事件发生时需要得到通知，例如，在串口接收缓冲区中有字符，或者 Carrier Detect (CD) 或 Request To Send (RTS) 线上一个字符到达或一个变化发生时。在这些情况下，可以利用 MSComm 控件的 OnComm 事件捕获并处理这些通讯事件。OnComm 事件还可以检查和处理通讯错误。所有通讯事件和通讯错误的列表，参阅
 CommEvent 属性。在编程过程中，就可以在OnComm事件处理函数中加入自己的处理代码。这种方法的优点是程序响应及时，可靠性高。每个MSComm 控件对应着一个串行端口。如果应用程序需要访问多个串行端口，必须使用多个 MSComm 控件。</span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px; background-color:rgb(255,255,255)">1.2 查询方式&nbsp;</span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px">查询方式实质上还是事件驱动，但在有些情况下，这种方式显得更为便捷。在程序的每个关键功能之后，可以通过检查 CommEvent 属性的&#20540;来查询事件和错误。如果应用程序较小，并且是自保持的，这种方法可能是更可取的。例如，如果写一个简单的电话拨号程序，则没有必要对每接收一个字符都产生事件，因为唯一等待接收的字符是调制解调器的“确定”响应。&nbsp;</span></span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px">2.MSComm控件的常用属性</span></span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; text-align:left; font-family:'Courier New'">MSComm1.Settings:=’9600,n,8,1’; //</span><span style="line-height:21px; text-align:left; font-family:宋体">设置波特率</span><span lang="EN-US" style="line-height:21px; text-align:left; font-family:'Courier New'">&nbsp;,</span><span style="line-height:21px; text-align:left; font-family:宋体">校验位</span><span lang="EN-US" style="line-height:21px; text-align:left; font-family:'Courier New'">,</span><span style="line-height:21px; text-align:left; font-family:宋体">数据位</span><span lang="EN-US" style="line-height:21px; text-align:left; font-family:'Courier New'">,</span><span style="line-height:21px; text-align:left; font-family:宋体">停止位</span></span><br>
</span></p>
<p align="left" style="margin-top:8px; margin-bottom:8px"></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 74.55pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-74.55pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Settings</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;</span><span style="line-height:21px; font-family:宋体">设置串口的波特率</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;,</span><span style="line-height:21px; font-family:宋体">校验位</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">数据位</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">停止位</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;’9600,n,8,1’</span><span style="line-height:21px; font-family:宋体">表示波特率为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">9600,</span><span style="line-height:21px; font-family:宋体">无奇偶校
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 验</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">数据位为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">8</span><span style="line-height:21px; font-family:宋体">为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,1</span><span style="line-height:21px; font-family:宋体">位停止位</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 74.55pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-74.55pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InBufferSize:=1024;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">接受缓冲区大小</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 96.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-96.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:25px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">InBufferSize&nbsp;</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong></span><span style="line-height:21px; font-family:宋体">接收缓冲区的大小</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">默认&#20540;为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">1024,</span><span style="line-height:21px; font-family:宋体">也可以自己设定</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">比如</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,
 MSComm1.InBufferSize:=2000,</span><span style="line-height:21px; font-family:宋体">则接收缓冲区的大小为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">2000</span><span style="line-height:21px; font-family:宋体">字节</span><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 96.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-96.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.OutBufferSize:=1024;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">发送缓冲区大小</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 96.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-96.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:25px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutBufferSize</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong></span><span style="line-height:21px; font-family:宋体">发送缓冲区的大小</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">默认&#20540;为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">1024,</span><span style="line-height:21px; font-family:宋体">也可以自己设定。
 &nbsp;</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)"><span style="font-size:18px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InBufferCount:=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//</span><span style="line-height:21px; font-family:宋体">清空接受缓冲区</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:25px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">InBufferCount</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong></span><span style="line-height:21px; font-family:宋体">当前接收缓冲区接收到的数据的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span lang="EN-US" style="line-height:25px"><span style="font-family:Times New Roman">&nbsp;</span></span><span lang="EN-US" style="line-height:25px; font-family:'Courier New'">count</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:=MSComm1.InBufferCount,</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 99pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-99pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="line-height:21px; font-family:宋体">则</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">count</span><span style="line-height:21px; font-family:宋体">&#20540;就是接收缓冲区接收到的数据的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">对</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">InBufferCount</span><span style="line-height:21px; font-family:宋体">赋
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#20540;</span><span style="line-height:21px; font-family:'Courier New'"><span lang="EN-US">MSComm1.InBufferCount:=0,</span></span><span style="line-height:21px; font-family:宋体">可以清空接受缓冲区</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 99pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-99pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.OutBufferCount:=0;&nbsp;&nbsp;&nbsp;&nbsp;//</span><span style="line-height:21px; font-family:宋体">清空发送缓冲区</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 99.4pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-99.4pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutBufferCount</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">当前发送缓冲区中数据的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">对</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutBufferCount&nbsp;</span><span style="line-height:21px; font-family:宋体">赋&#20540;</span><span style="line-height:21px; font-family:'Courier New'">&nbsp;</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 99.4pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-99.4pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:'Courier New'"><span lang="EN-US">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MSComm1. OutBufferCount:=0,</span></span><span style="line-height:21px; font-family:宋体">可以清空发送缓冲区</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)"><span style="font-size:18px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InputMode:=comInputModeText;//&nbsp;</span><span style="line-height:21px; font-family:宋体">以文本方式取回数据</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InputMode:=comInputModeBinary; //</span><span style="line-height:21px; font-family:宋体">设置接收数据模式为二进制形式</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">InputMode</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">串口接收数据的模式</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,
 comInputModeText(0)</span><span style="line-height:21px; font-family:宋体">表示以文本</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">(ASCII)</span><span style="line-height:21px; font-family:宋体">方式取回数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comInputModeBinary(1)</span><span style="line-height:21px; font-family:宋体">表示以二进制方式取回数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comInputModeText, comInputModeBinary</span><span style="line-height:21px; font-family:宋体">为预定义常量</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">分别表示</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">0,1</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)">RcvByte:=MSComm1.Input</span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 57.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-57.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Input</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">通过</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Input</span><span style="line-height:21px; font-family:宋体">属性可以读取串口中接收到的数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,RcvByte:=MSComm1.Input</span><span style="line-height:21px; font-family:宋体">表示读取串口接收到的数据</span><span style="line-height:21px; font-family:'Courier New'">&nbsp;<span lang="EN-US">,</span></span><span style="line-height:21px; font-family:宋体">其中</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">RcvByte</span><span style="line-height:21px; font-family:宋体">的数据类型为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span><span lang="EN-US" style="line-height:25px"><span style="font-family:Times New Roman">&nbsp;</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">array
 of&nbsp;&nbsp;Byte&nbsp;</span><span style="line-height:21px; font-family:宋体">或</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">array of&nbsp;&nbsp;Variant.</span><span style="line-height:21px; font-family:宋体">在读取之前先设置</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">RcvByte</span><span style="line-height:21px; font-family:宋体">的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:SetLength(RcvByte,len),</span><span style="line-height:21px; font-family:宋体">如果一次读取所有数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">则</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">SetLength(RcvByte,
 MSComm1.InBufferCount)</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 57.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-57.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.Output:=</span><span lang="EN-US" style="line-height:25px"><span style="font-family:Times New Roman">&nbsp;</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutputDat</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 57.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-57.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Output</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">通过</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Output</span><span style="line-height:21px; font-family:宋体">属性可以发送数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span lang="EN-US" style="line-height:25px"><span style="font-family:Times New Roman">&nbsp;</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.Output:=OutputDat,</span><span style="line-height:21px; font-family:宋体">则将</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutputDat</span><span style="line-height:21px; font-family:宋体">中的数据发送出去</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">其中</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutputDat</span><span style="line-height:21px; font-family:宋体">数据类型为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">array
 of&nbsp;&nbsp;Byte,</span><span style="line-height:21px; font-family:宋体">发送前要设置</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutputDat</span><span style="line-height:21px; font-family:宋体">的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,
 SetLength(OutputDat,len),</span><span style="line-height:21px; font-family:宋体">然后向</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OutputDat</span><span style="line-height:21px; font-family:宋体">中填入数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">再清空发送缓冲区</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.OutBufferCount:=0,</span><span style="line-height:21px; font-family:宋体">然后再发送</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.Output:=OutputDat</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 57.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-57.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InputLen:=0; &nbsp; //&nbsp;</span><span style="line-height:21px; font-family:宋体">一次读取所有数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)"><span style="font-size:18px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 70.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-70.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">InputLen</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">一次从</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">Input</span><span style="line-height:21px; font-family:宋体">属性中读取数据的长度</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,
 MSComm1.InputLen:=1,</span><span style="line-height:21px; font-family:宋体">表示一次读取一个字节</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">如果</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.InputLen:=0,</span><span style="line-height:21px; font-family:宋体">则表示一次读取全部数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.SThreshold:=0; //</span><span style="line-height:21px; font-family:宋体">一次发送所有数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;,</span><span style="line-height:21px; font-family:宋体">发送数据时不产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)"><span style="font-size:18px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 78.9pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-78.9pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">SThreshold</span><span style="line-height:21px; font-family:宋体">属性</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">通过该属性设置产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">(</span><span style="line-height:21px; font-family:宋体">发送时产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">)</span><span style="line-height:21px; font-family:宋体">的阀&#20540;</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">若</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.SThreshold:=0,&nbsp;</span><span style="line-height:21px; font-family:宋体">则一次发送所有数据</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;,</span><span style="line-height:21px; font-family:宋体">发送数据时不产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,&nbsp;</span><span style="line-height:21px; font-family:宋体">若</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.SThreshold:=5,</span><span style="line-height:21px; font-family:宋体">当发送缓冲区的字节数从</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">5</span><span style="line-height:21px; font-family:宋体">字节减少到</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">4</span><span style="line-height:21px; font-family:宋体">字节时</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,&nbsp;</span><span style="line-height:21px; font-family:宋体">产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span style="line-height:21px; font-family:'Courier New'"><span lang="EN-US"></span></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 78.9pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-78.9pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.RThreshold:=1; //</span><span style="line-height:21px; font-family:宋体">每接收</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">1</span><span style="line-height:21px; font-family:宋体">个字节就产生一个</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span></span><span style="font-family:'Courier New'; line-height:21px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 83.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-83.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">RThreshold</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;</span></strong><span style="line-height:21px; font-family:宋体">通过该属性设置产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">(</span><span style="line-height:21px; font-family:宋体">接收时产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">)</span><span style="line-height:21px; font-family:宋体">的阀&#20540;</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">若</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.RThreshold:=0,</span><span style="line-height:21px; font-family:宋体">不产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">若</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.RThreshold:=5,</span><span style="line-height:21px; font-family:宋体">接收缓冲区每收到</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">5</span><span style="line-height:21px; font-family:宋体">字节时</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">则产生</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span><span style="line-height:25px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"></span></span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt 83.2pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:-83.2pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.PortOpen:=True;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//</span><span style="line-height:21px; font-family:宋体">打开串口</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><strong>PortOpen</strong></span><span style="line-height:25px"><strong><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong></span><span style="line-height:21px; font-family:宋体">设置端口的打开与关闭</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,</span><span style="line-height:21px; font-family:宋体">打开端口</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.PortOpen:=True,</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:72pt">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span style="line-height:21px; font-family:宋体">关闭端口</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">MSComm1.PortOpen:=False</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left; text-indent:72pt">
<span style="font-size:18px"><span style="background-color:rgb(255,255,255)"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
MSComm1.CommPort:=CommPort;</span></span><span style="font-family:'Courier New'; line-height:21px; text-indent:72pt">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">CommPort</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:</span></strong><span style="line-height:21px; font-family:宋体">设置端口号</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">,
 MSComm1.CommPort:=1,&nbsp;</span><span style="line-height:21px; font-family:宋体">设置端口号为</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">COM1</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">CommEvent</span><span style="line-height:21px; font-family:宋体">属性</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">:&nbsp;</span></strong><span style="line-height:21px; font-family:宋体">常用的两个</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">comEvReceive,
 comEvSend</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span lang="EN-US" style="line-height:21px; font-family:'Courier New'; background-color:rgb(255,255,255)"><span style="font-size:18px">&nbsp;</span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">常数</span></strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><strong>&nbsp;&nbsp;</strong><br>
<br>
</span><span style="line-height:21px; font-family:宋体">常数</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">&#20540;</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">描述</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvSend&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">发送事件。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvReceive &nbsp; &nbsp; &nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">接收事件。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvCTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clear-to-send&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">线变化。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvDSR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data-set&nbsp;&nbsp; ready&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">线变化。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvCD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;carrier&nbsp;&nbsp; detect&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">线变化。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvRing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">振铃检测。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br>
comEvEOF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">文件结束。</span><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">&nbsp; &nbsp;&nbsp;</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><span lang="EN-US" style="line-height:21px; font-family:'Courier New'"><br>
</span></span></span></p>
<p align="left" style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><br>
</span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="font-family:Arial,Helvetica,simsun,u5b8bu4f53">////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</span></span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="font-family:Arial,Helvetica,simsun,u5b8bu4f53"><br>
</span></span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="font-family:Arial,Helvetica,simsun,u5b8bu4f53"><strong>ComPort属性：</strong></span><span style="font-family:Arial,Helvetica,simsun,u5b8bu4f53; white-space:pre">
</span><span style="font-family:宋体,Arial,'Times New Roman'">设置并返回通讯端口号。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法 object.CommPort[value ] (value 一整型&#20540;，说明端口号。)&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明 在设计时，value 可以设置成从 1 到 16 的任何数（缺省&#20540;为 1）。但是如果用 PortOpen 属性打开一个并不存在的端口时，MSComm 控件会产生错误 68（设备无效）。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">注意：必须在打开端口之前设置 CommPort 属性。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>RThreshold属性：</strong>在 MSComm 控件设置 CommEvent 属性为 comEvReceive 并产生 OnComm 之前，设置并返回的要接收的字符数。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法 object.Rthreshold [ = value ]（value 整型表达式，说明在产生 OnComm 事件之前要接收的字符数。 ）</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明 当接收字符后，若 Rthreshold 属性设置为 0（缺省&#20540;）则不产生 OnComm 事件。例如，设置 Rthreshold 为 1，接收缓冲区收到每一个字符都会使 MSComm 控件产生 OnComm 事件。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong><span style="font-family:宋体,Arial,'Times New Roman'; line-height:16px">CTSHolding属性：</span></strong>确定是否可通过查询 Clear To Send (CTS) 线的状态发送数据。Clear To Send 是调制解调器发送到相联计算机的信号，指示传输可以进行。该属性在设计时无效，在运行时为只读。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法： object.CTSHolding（Boolean）</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">Mscomm 控件的 CTSHolding 属性设置&#20540;：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">True Clear To Send 线为高电平。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">False Clear To Send 线为低电平。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：如果 Clear To Send 线为低电平 (CTSHolding = False) 并且超时时，MSComm 控件设置 CommEvent 属性为 comEventCTSTO (Clear To Send Timeout) 并产生 OnComm 事件。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">Clear To Send 线用于 RTS/CTS (Request To Send/Clear To Send) 硬件握手。如果需要确定 Clear To Send 线的状态，CTSHolding 属性给出一种手工查询的方法。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">详细信息 有关握手协议，请参阅 Handshaking 属性。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><span style="font-family:宋体,Arial,'Times New Roman'; line-height:16px"><strong>SThreshold属性：</strong></span>&nbsp;MSComm 控件设置 CommEvent 属性为 comEvSend 并产生 OnComm 事件之前，设置并返回传输缓冲区中允许的最小字符数。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法 object.SThreshold [ = value ]</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">value 整形表达式，代表在 OnComm 事件产生之前在传输缓冲区中的最小字符数。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：若设置 Sthreshold 属性为 0（缺省&#20540;），数据传输事件不会产生 OnComm 事件。若设置 Sthreshold 属性为 1，当传输缓冲区完全空时，MSComm 控件产生 OnComm 事件。如果在传输缓冲区中的字符数小于 value，CommEvent 属性设置为 comEvSend，并产生 OnComm 事件。comEvSend 事件仅当字符数与 Sthreshold 交叉时被激活一次。例如，如果
 Sthreshold 等于 5，仅当在输出队列中字符数从 5 降到 4 时，comEvSend 才发生。如果在输出队列中从没有比 Sthreshold 多的字符，comEvSend 事件将绝不会发生。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,Times New Roman"><strong>HandShake 常数</strong></span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">常数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#20540; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comNone &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;无握手。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comXonXoff &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;XOn/Xoff 握手。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comRTS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Request-to-send/clear-to-send 握手。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comRTSXOnXOff &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Request-to-send 和 clear-to-send 握手皆可。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,Times New Roman"><strong>OnComm 常数</strong></span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">常数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#20540; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvSend &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; 发送事件。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvReceive &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; &nbsp; 接收事件。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvCTS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; clear-to-send 线变化。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvDSR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; &nbsp; &nbsp; &nbsp; data-set ready 线变化。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvCD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp; &nbsp; carrier detect 线变化。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvRing &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6 &nbsp; &nbsp; &nbsp; &nbsp; 振铃检测。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEvEOF &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7 &nbsp; &nbsp; &nbsp; &nbsp; 文件结束。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,Times New Roman"><strong>Error常数</strong></span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">常数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#20540; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventBreak &nbsp; &nbsp;1001 &nbsp; &nbsp; &nbsp; &nbsp;接收到中断信号&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventCTSTO &nbsp; &nbsp;1002 &nbsp; &nbsp; &nbsp; &nbsp;Clear-to-send 超时&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventDSRTO &nbsp; &nbsp;1003 &nbsp; &nbsp; &nbsp; &nbsp;Data-set ready 超时&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventFrame &nbsp; &nbsp;1004 &nbsp; &nbsp; &nbsp; &nbsp;帧错误&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventOverrun &nbsp;1006 &nbsp; &nbsp; &nbsp; &nbsp;端口超速&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventCDTO &nbsp; &nbsp; 1007 &nbsp; &nbsp; &nbsp; &nbsp;Carrier detect 超时&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventRxOver &nbsp; 1008 &nbsp; &nbsp; &nbsp; &nbsp;接收缓冲区溢出&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventRxParity 1009 &nbsp; &nbsp; &nbsp; &nbsp;Parity 错误&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventTxFull &nbsp; 1010 &nbsp; &nbsp; &nbsp; &nbsp;传输缓冲区满&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comEventDCB &nbsp; &nbsp; &nbsp;1011 &nbsp; &nbsp; &nbsp; &nbsp;检索端口 设备控制块 (DCB) 时的意外错误&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><br>
</span></span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-family:宋体,Arial,'Times New Roman'"><span style="font-size:18px"><strong>InputMode常数</strong>&nbsp;</span></span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="font-family:宋体,Arial,'Times New Roman'">常数 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#20540; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comInputModeText &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; （缺省）通过 Input 属性以文本方式取回数据。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">comInputModeBinary &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;通过 Input 属性以二进制方式检取回数据。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>CDHolding属性：</strong>通过查询 Carrier Detect (CD) 线的状态确定当前是否有传输。Carrier Detect 是从调制解调器发送到相联计算机的一个信号，指示调制解调器正在联机。该属性在设计时无效，在运行时为只读。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法 object.CDHolding</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">设置&#20540;：CDHolding 属性的设置&#20540;为：&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">设置 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">True Carrier Detect 线为高电平&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">False Carrier Detect 线为低电平&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：注意当 Carrier Detect 线为高电平 (CDHolding = True) 且超时时，MSComm 控件设置CommEvent 属性为 comEventCDTO（Carrier Detect 超时错误），并产生 OnComm 事件。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">注意 在主机应用程序中捕获一个丢失的传输是特别重要的，例如一个公告板，因为呼叫者可以随时挂起（放弃传输）。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">Carrier Detect 也被称为 Receive Line Signal Detect (RLSD)。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">数据类型 Boolean</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>DSRHolding属性：</strong>确定 Data Set Ready (DSR) 线的状态。Data Set Ready 信号由调制解调器发送到相连计算机，指示作好操作准备。该属性在设计时无效，在运行时为只读。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法：object.DSRHolding</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">object 所在处表示对象表达式，其&#20540;是“应用于”列表中的对象。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">DSRHolding 属性返回以下&#20540;：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">&#20540; 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">True Data Set Ready 线高&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">False Data Set Ready 线低&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：当 Data Set Ready 线为高电平 (DSRHolding = True) 且超时时，MSComm 控件设置 CommEvent 属性为 comEventDSRTO（数据准备超时）并产生 OnComm 事件。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">当为 Data Terminal Equipment (DTE) 机器写 Data Set Ready/Data Terminal Ready 握手例程时该属性是十分有用的。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">数据类型：Boolean</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>Setting属性：</strong>&nbsp;设置并返回波特率、奇偶校验、数据位、停止位参数。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法: object.Settings[ = value]</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：当端口打开时，如果 value 非法，则 MSComm 控件产生错误 380（非法属性&#20540;）。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">Value 由四个设置&#20540;组成，有如下的&#26684;式：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">&quot;BBBB,P,D,S&quot;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">BBBB 为波特率，P 为奇偶校验，D 为数据位数，S 为停止位数。value 的缺省&#20540;是：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">&quot;9600,N,8,1&quot;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>InputLen属性：</strong>设置并返回 Input 属性从接收缓冲区读取的字符数。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法 object.InputLen [ = value]</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">InputLen 属性语法包括下列部分：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">value 整型表达式，说明 Input 属性从接收缓冲区中读取的字符数。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：InputLen 属性的缺省&#20540;是 0。设置 InputLen 为 0 时，使用 Input 将使 MSComm 控件读取接收缓冲区中全部的内容。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">若接收缓冲区中 InputLen 字符无效，Input 属性返回一个零长度字符串 (&quot;&quot;)。在使用 Input 前，用户可以选择检查 InBufferCount 属性来确定缓冲区中是否已有需要数目的字符。该属性在从输出&#26684;式为定长数据的机器读取数据时非常有用。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>EofEnable属性：</strong>确定在输入过程中 MSComm 控件是否寻找文件结尾 (EOF) 字符。如果找到 EOF 字符，将停止输入并激活 OnComm 事件，此时 CommEvent 属性设置为 comEvEOF，</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">语法：object.EOFEnable [ = value ]</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">EOFEnable 属性语法包括下列部分：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">value 布尔表达式，确定当找到 EOF 字符时，OnComm 事件是否被激活，如“设置&#20540;”中所描述。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">value 的设置&#20540;：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">True 当 EOF 字符找到时 OnComm 事件被激活。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">False （缺省）当 EOF 字符找到时 OnComm 事件不被激活。&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">说明：当 EOFEnable 属性设置为 False，OnComm 控件将不在输入流中寻找 EOF 字符。</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'"><strong>错误消息：</strong>（MS Comm 控件）</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">下表列出 MSComm 控件可以捕获的错误：</span><br style="font-family:宋体,Arial,'Times New Roman'">
<br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">&#20540; 描述&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">380 无效属性&#20540; comInvalidPropertyValue</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">383 属性为只读 comSetNotSupported</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">394 属性为只读 comGetNotSupported&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8000 端口打开时操作不合法 comPortOpen</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8001 超时&#20540;必须大于 0&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8002 无效端口号 comPortInvalid</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8003 属性只在运行时有效&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8004 属性在运行时为只读&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8005 端口已经打开 comPortAlreadyOpen</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8006 设备标识符无效或不支持该标识符&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8007 不支持设备的波特率&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8008 指定的字节大小无效&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8009 缺省参数错误&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8010 硬件不可用（被其它设备锁定）&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8011 函数不能分配队列&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8012 设备没有打开 comNoOpen&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8013 设备已经打开&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8014 不能使用 comm 通知&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8015 不能设置 comm 状态 comSetCommStateFailed</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8016 不能设置 comm 事件屏蔽&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8018 仅当端口打开时操作才有效 comPortNotOpen&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8019 设备忙&nbsp;</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8020 读 comm 设备错误 comReadError</span><br style="font-family:宋体,Arial,'Times New Roman'">
<span style="font-family:宋体,Arial,'Times New Roman'">8021 为该端口检索设备控制块时的内部错误 comDCBError&nbsp;</span></span></p>
<p align="left" style="line-height:12pt; margin:0cm 0cm 0pt; padding-top:0px; padding-bottom:0px; text-align:left">
<span style="font-size:18px"><span style="font-family:宋体,Arial,'Times New Roman'"><br>
</span></span></p>
<span style="font-family:宋体,Arial,Times New Roman; font-size:18px"><strong>3.使用</strong></span>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="background-color:rgb(255,255,255)"><span style="font-size:18px"><strong>端口初始化设置：</strong></span></span></p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px"></span><pre name="code" class="delphi" style="background-color: rgb(255, 255, 255); ">procedure TFMonitorCenter.SBtnOpenPortClick(Sender: TObject);
var
 i,CommPort:integer;
 Speed,DataBit,StopBit,CheckBit,SetString:string;
begin
  CommPort:=1;
  Speed:='115200';
  DataBit:='8';
  CheckBit[1]:='N';
  StopBit:='1';
   if MSComm1.PortOpen=False then
   begin
       MSComm1.CommPort:=CommPort;   //设置端口
       SetString:=Speed+','+CheckBit[1]+','+DataBit+','+StopBit;
       MSComm1.Settings:=SetString;    //设置波特率 ,校验位,数据位,停止位
       MSComm1.InBufferSize:=1024;    //  接受缓冲区大小
       MSComm1.OutBufferSize:=1024;   //  发送缓冲区大小
       MSComm1.InBufferCount:=0;     //清空接受缓冲区
       MSComm1.OutBufferCount:=0;    //清空发送缓冲区
      //////// MSComm1.InputMode:=comInputModeText;// 以文本方式取回数据
       MSComm1.InputMode:=comInputModeBinary; //设置接收数据模式为二进制形式
       MSComm1.InputLen:=0;//////////////  一次读取所有数据 /////////
       MSComm1.SThreshold:=0;//一次发送所有数据 ,发送数据时不产生OnComm 事件
       MSComm1.RThreshold:=1;//////////// 每接收1个字节就产生一个OnComm 事件
       MSComm1.PortOpen:=True;       //打开串口
   end;
end;</pre><br>
<span style="line-height:25px; font-family:Arial,Helvetica,simsun,u5b8bu4f53; text-align:left; background-color:rgb(255,255,255)"><strong><span lang="EN-US" style="line-height:21px; font-family:'Courier New'">OnComm&nbsp;&nbsp;</span><span style="line-height:21px; font-family:宋体">事件</span></strong></span><br>
</p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; margin-top:8px; margin-bottom:8px">
<span style="font-size:18px"><span style="line-height:25px; font-family:Arial,Helvetica,simsun,u5b8bu4f53; text-align:left; background-color:rgb(255,255,255)"><strong><span style="line-height:21px; font-family:宋体"></span></strong></span></span><pre name="code" class="delphi">procedure TFMonitorCenter.MSComm1Comm(Sender: TObject);
var
 str:string;
 RcvByte: array of  Byte;  // RcvByte存放缓冲区的数据
 i,len,NumOfFlag:integer;  //NumOfFlag  为一次OnComm事件中接收到的字符'~' 的个数
 OldCRCResult,NewCRCResult:WORD;
 CRCByte:array[0..255] of Byte;
begin
  if(MSComm1.CommEvent=comEvReceive) then //接收事件
  begin                                          //接收缓冲区中是否收到Rthreshold 个字符
     if(MSComm1.InBufferCount&lt;&gt;0)   then     //缓冲区有数据
     begin
          len:=MSComm1.InBufferCount;  //缓冲区数据长度
          SetLength(RcvByte,len);  //设置动态数组的长度
          RcvByte:=MSComm1.Input;
 
          ......
          
end;
 
end;
//*****************************************************//
if (MSComm1.CommEvent= comEvSend) then//发送事件
begin
  ......
end;
 
 
 
end;</pre><br>
<br>
</p>
<p align="left" style="font-family:宋体,Arial,'Times New Roman'; color:rgb(0,102,102); margin-top:8px; margin-bottom:8px">
<span style="color:#000000"><br>
</span></p>
   
</div>




<!-- Baidu Button BEGIN -->




<div class="bdsharebuttonbox tracking-ad" style="float: right;" data-mod="popu_172">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"  style="background-position:0 -52px !important"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"style="background-position:0 -104px !important"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"style="background-position:0 -260px !important"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"style="background-position:0 -208px !important"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"style="background-position:0 -1612px !important" ></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

   <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_detail.css" />

    
<!--172.16.140.15-->

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->

 


        <div id="digg" ArticleId="8177047" >
            <dl id="btnDigg" class="digg digg_disable"  onclick="btndigga();">
               
                 <dt>顶</dt>
                <dd>1</dd>
            </dl>
           
              
            <dl id="btnBury" class="digg digg_disable"  onclick="btnburya();">
              
                  <dt>踩</dt>
                <dd>0</dd>               
            </dl>
            
        </div>
     <div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" >&nbsp;</a>   </div>
    <div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" >&nbsp;</a></div>
    <script type="text/javascript">
                function btndigga() {
                    $(".tracking-ad[data-mod='popu_222'] a").click();
                }
                function btnburya() {
                    $(".tracking-ad[data-mod='popu_223'] a").click();
                }
            </script>

   <ul class="article_next_prev">
                <li class="prev_article"><span  onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/dongyue786/article/details/8174841';">上一篇</span><a href="/dongyue786/article/details/8174841" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian'])">C#网络编程系列十：实现简单的邮件收发器</a></li>
                <li class="next_article"><span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/dongyue786/article/details/8177799';">下一篇</span><a href="/dongyue786/article/details/8177799" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian'])">Delphi 异常处理 详解</a></li>
    </ul>

    <div style="clear:both; height:10px;"></div>


        <div class="similar_article"  style="display:none">
                <h4>我的同类文章</h4>
                <div class="similar_c"style="margin:20px 0px 0px 0px">
                    <div class="similar_c_t">
                                <label class="similar_cur">
                                    <span  style="cursor:pointer"  onclick="GetCategoryArticles('1194360','dongyue786','foot','8177047');">Delphi编程<em>（13）</em></span>
                                </label>
                    </div>
                   
                    <div class="similar_wrap tracking-ad" data-mod="popu_141"  style="max-height:195px;">
                        <a href="http://blog.csdn.net" style="display:none">http://blog.csdn.net</a>
                        <ul class="similar_list fl">                          
                        </ul>

                        <ul class="similar_list fr">                           
                        </ul>
                    </div>
                </div>
            </div>    
    <script  type="text/javascript">
        $(function () {
            GetCategoryArticles('1194360', 'dongyue786','foot','8177047');
        });
    </script>
      
</div>

    <div>
            <ins data-revive-zoneid="205" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins> 
     </div>

<div id="suggest"></div>
         <script  language="javascript" type='text/javascript'>     
             $(function(){
                 $.get("/dongyue786/svc/GetSuggestContent/8177047",function(data){
                     $("#suggest").html(data);
                 });     
             });             
         </script>  


<style>
.blog-ass-articl dd {
color: #369;
width: 99%; /*修改行*/
float: left;
overflow: hidden;
font: normal normal 12px/23px "SimSun";
height: 23px;
margin: 0;
padding: 0 0 0 10px;
margin-right: 30px;
background: url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;
}
</style>

 <link rel="stylesheet" href="http://static.blog.csdn.net/css/replace.css"/>
<div id="relate" data-mod="popu_218"  class="tracking-ad">
        <div class="relate_t">
            <h3><span>参考知识库</span></h3>
        </div>
        <div class="relate_c">
        </div>
</div>
 

<dl class="blog-ass-articl" id="res-relatived" > 
    <div class="embody embody_b" id="libkeyparent"  style="display:none">
            <span class="embody_t">更多资料请参考：</span>
            <div class="embody_c" id="libkey"></div>
    </div>


     <dt><span>猜你在找</span></dt>    


   


    <div id="adCollege" style="width: 42%;float: left;"> 
        <script src="http://csdnimg.cn/jobreco/job_reco.js" type="text/javascript"></script> 
        <script type="text/javascript">
            csdn.position.showEdu({
                sourceType: "blog",
                searchType: "detail",
                searchKey: "8177047",
                username: "",
                recordcount: "5",
                containerId: "adCollege" //容器DIV的id。 
            });
            
            setEduLoc();

            function setEduLoc() {               
                var edus = $("#adCollege div dd a");
                if (edus.length == 0) {
                    setTimeout(function () {
                        setEduLoc();
                    }, 500);
                }
                else {
                    var eduLoc = "?ref=blog&loc=0";
                    $.each(edus, function (index,item) {
                        var href = $(this).attr("href") + eduLoc;
                        $(this).attr("href", href);
                    });
                }
            }

        </script> 
    </div>  

    
     <div id="res"  data-mod="popu_36"  class="tracking-ad" style="width: 42%;float: left;margin-right: 30px;"></div>
   
</dl>


<script type="text/javascript">
    $(function () {
        setTimeout(function () {
            var searchtitletags = '串口通信-MSComm控件使用详解' + ',' + $("#tags").html();
            searchService({
                index: 'blog',
                query: searchtitletags,
                from: 5,
                size: 5,
                appendTo: '#res',
                url: 'recommend',
                his: 2,
                client: "blog_cf_enhance",
                tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
            });
        }, 500);
    });    

 </script>  


    <div id="ad_cen">        
<ins data-revive-zoneid="71" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>    </div>  

    <!-- 广告位开始 -->
    <ins data-revive-zoneid="72" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
    <!-- 广告位结束 -->

<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list">
    </div>
    <div id="comment_bar">
    </div>
    <div id="comment_form">
    </div>
    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '8177047';
    var commentscount = 0;
    var islock = false
</script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/comment.js"></script>
    <div id="ad_bot">
    </div>
<div id="report_dialog">
</div>

<div id="d-top"  style="bottom:60px;">

        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="http://static.blog.csdn.net/images/blog-icon-reply.png" alt="快速回复">
        </a>    
    <a id="d-top-a" class="btn btn-top backtop"  style="display: none;" title="返回顶部" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_huidaodingbu'])" style="">         
         <img src="http://static.blog.csdn.net/images/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);    
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>


<div class="tag_list" style="display:none"></div>
  <script  language="javascript" type='text/javascript'>     
      $(function(){
              setTimeout(function(){
                  $.get("/dongyue786/svc/GetTagContent",function(data){
                      $(".tag_list").html(data).show();
                  });     
              });
          },500);                       
 </script> 


<div id="pop_win" style="display:none ;position: absolute; z-index: 10000; border: 1px solid rgb(220, 220, 220); top: 222.5px; left: 630px; opacity: 1; background: none 0px 0px repeat scroll rgb(255, 255, 255);">
    
</div>
<div id="popup_mask"></div>
<style>
    #popup_mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        left: 0px;
        top: 0px;
        opacity: 0.3;
        filter: alpha(opacity=30);
        display: none;
    }

</style>




<script type="text/javascript">
    $(function(){
        setTimeout(function(){
            $(".comment_body:contains('回复')").each(function(index,item){
                var u=$(this).text().split('：')[0].toString().replace("回复","")
                var thisComment=$(this);
                if(u)
                {
                    $.getJSON("https://passport.csdn.net/get/nick?callback=?", {users: u}, function(a) {
                        if(a!=null&&a.data!=null&&a.data.length>0)
                        {
                            nick=a.data[0].n; 
                            if(u!=nick)
                            {
                                thisComment.text(thisComment.text().replace(u,nick));  
                            }
                        }       
                    });  
                }
            });         

        },200);  

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },5000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },10000);

        setTimeout(function(){
            $(".math").each(function(index,value){$(this).find("span").last().css("color","#fff"); })
        },15000);
        
        setTimeout(function(){
            $("a img[src='http://js.tongji.linezing.com/stats.gif']").parent().css({"position":"absolute","left":"50%"});
        },300);
    });

    function loginbox(){
        var $logpop=$("#pop_win");
        $logpop.html('<iframe src="https://passport.csdn.net/account/loginbox?service=http://static.blog.csdn.net/callback.htm" frameborder="0" height="600" width="400" scrolling="no"></iframe>');

        $('#popup_mask').css({
            opacity: 0.5,
            width: $( document ).width() + 'px',
            height:  $( document ).height() + 'px'
        });
        $('#popup_mask').css("display","block");
 
        $logpop.css( {
            top: ($( window ).height() - $logpop.height())/ 2  + $( window 
       ).scrollTop() + 'px',
            left:($( window ).width() - $logpop.width())/ 2
        } );
 
        setTimeout( function () {
            $logpop.show();
            $logpop.css( {
                opacity: 1
            } );
        }, 200 );
 
        $('#popup_mask').unbind("click");
        $('#popup_mask').bind("click", function(){
            $('#popup_mask').hide();
            var $clopop = $("#pop_win");
            $("#common_ask_div_sc").css("display","none");
            $clopop.css( {
                opacity: 0
            } );
            setTimeout( function () {
                $clopop.hide();
            }, 350 );
            return false;
        });
    }   

</script>
 <script language="javascript" type="text/javascript" src="http://ads.csdn.net/js/async_new.js"></script>      




                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
                   
           <div id="side">
               
    <div class="side">
<div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/dongyue786" target="_blank">
    <img src="http://avatar.csdn.net/4/2/9/1_dongyue786.jpg" title="访问我的空间" style="max-width:90%"/>
    </a>
    <br />
    <span><a href="http://my.csdn.net/dongyue786" class="user_name" target="_blank">dongyue786</a></span>
</div>
<div class="interact">

    <a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]"></a>

 <a href="javascript:void(0);" class="letter"  title="[发私信]" onclick="window.open('http://msg.csdn.net/letters/model?receiver=dongyue786','_blank','height=350,width=700');_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_sixin'])"></a>  
</div>
<div id="blog_medal">
                <div id="bms_box">
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>80006次</span></li>
    <li>积分：<span>942</span> </li>    
    <li >等级： <span style="position:relative;display:inline-block;z-index:1" >
            <img src="http://c.csdnimg.cn/jifen/images/xunzhang/jianzhang/blog3.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：942 </div>
        </span>  </li>
    <li>排名：<span>千里之外</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>6篇</span></li>
    <li>转载：<span>62篇</span></li>
    <li>译文：<span>6篇</span></li>
    <li>评论：<span>2条</span></li>
</ul>
</ul>
</div>


<div class="panel" id="panel_Search">
    <ul class="panel_head"><span>文章搜索</span></ul>
    <ul class="panel_body">
        <form id="frmSearch" action="http://so.csdn.net/search" class="form_search" target="_blank">
        <span><input id="inputSearch" type="text" class="blogsearch" title="请输入关键字" /></span>
        <input id="btnSubmit" type="button" value="搜索" title="search in blog" />
        <input type="hidden" name="q" id="inputQ" />
        <input type="hidden" name="t" value="blog" />
        <a id="btnSearchBlog" target="_blank"></a>
        </form>
    </ul>
</div>

<script type="text/javascript">
    $(function () {
        $("#btnSubmit").click(function () {           
            search();
        });

        $("#frmSearch").submit(function () {
            search();
            return false;
        });

        function search()
        {
            var url = "http://so.csdn.net/so/search/s.do?q=" + encodeURIComponent($("#inputSearch").val()) + "&u=" + username + "&t=blog";
            window.location.href = url;
        }   
    });
</script><div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">    
                 <li>
                    <a href="/dongyue786/article/category/1194356" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">C#编程</a><span>(23)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/941608" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Windows编程</a><span>(13)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1226245" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">C/C++ 编程</a><span>(8)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1219673" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Web编程</a><span>(18)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1214131" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">网络编程</a><span>(12)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1213650" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">.Net编程</a><span>(13)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1345707" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Asp.Net编程</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1213649" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">总结</a><span>(5)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1194360" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Delphi编程</a><span>(14)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1279739" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">控件编程</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1259221" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">Java编程</a><span>(7)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1194358" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">数据库技术及其编程</a><span>(7)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1194359" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">数据结构和算法</a><span>(1)</span>
                </li>
                 <li>
                    <a href="/dongyue786/article/category/1213648" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_wenzhangfenlei']); ">软件工程</a><span>(0)</span>
                </li>
</ul>
</div><div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list">
<!--归档统计-->
<li><a href="/dongyue786/article/month/2014/10">2014年10月</a><span>(9)</span></li><li><a href="/dongyue786/article/month/2013/06">2013年06月</a><span>(3)</span></li><li><a href="/dongyue786/article/month/2013/05">2013年05月</a><span>(7)</span></li><li><a href="/dongyue786/article/month/2013/04">2013年04月</a><span>(5)</span></li><li><a href="/dongyue786/article/month/2013/03">2013年03月</a><span>(1)</span></li><li><a href="/dongyue786/article/month/2013/02">2013年02月</a><span>(5)</span></li><li><a href="/dongyue786/article/month/2012/12">2012年12月</a><span>(5)</span></li><li><a href="/dongyue786/article/month/2012/11">2012年11月</a><span>(18)</span></li><li><a href="/dongyue786/article/month/2012/10">2012年10月</a><span>(12)</span></li><li><a href="/dongyue786/article/month/2012/09">2012年09月</a><span>(3)</span></li><li><a href="/dongyue786/article/month/2012/08">2012年08月</a><span>(6)</span></li>
</div>
</ul>
</div>
<div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="/dongyue786/article/details/8177047" title="串口通信-MSComm控件使用详解">串口通信-MSComm控件使用详解</a><span>(14998)</span>
</li>
<li>
<a href="/dongyue786/article/details/8110757" title="DELPHI 格式化日期和字符串">DELPHI 格式化日期和字符串</a><span>(13930)</span>
</li>
<li>
<a href="/dongyue786/article/details/8181884" title="有关于串口通信程序的编写">有关于串口通信程序的编写</a><span>(4326)</span>
</li>
<li>
<a href="/dongyue786/article/details/8177799" title="Delphi 异常处理 详解">Delphi 异常处理 详解</a><span>(2503)</span>
</li>
<li>
<a href="/dongyue786/article/details/7925114" title="回调函数和函数指针调用实现机制及其区别">回调函数和函数指针调用实现机制及其区别</a><span>(2470)</span>
</li>
<li>
<a href="/dongyue786/article/details/8139174" title="Delphi 函数大全">Delphi 函数大全</a><span>(2131)</span>
</li>
<li>
<a href="/dongyue786/article/details/8251563" title="Delphi 字符、字符串、字符数组和字符指针及其相关函数">Delphi 字符、字符串、字符数组和字符指针及其相关函数</a><span>(1727)</span>
</li>
<li>
<a href="/dongyue786/article/details/8174841" title="C#网络编程系列十：实现简单的邮件收发器">C#网络编程系列十：实现简单的邮件收发器</a><span>(1448)</span>
</li>
<li>
<a href="/dongyue786/article/details/8621464" title="网站权限控制">网站权限控制</a><span>(1422)</span>
</li>
<li>
<a href="/dongyue786/article/details/7992217" title="Access violation at address 问题与解决方法">Access violation at address 问题与解决方法</a><span>(1102)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="/dongyue786/article/details/8174813" title="C#网络编程系列九：类似QQ的即时通信程序">C#网络编程系列九：类似QQ的即时通信程序</a><span>(2)</span>
</li>
<li>
<a href="/dongyue786/article/details/8081181" title="如何建立Java Web开发环境(1)">如何建立Java Web开发环境(1)</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7992319" title="学习c/c++的50个好网站">学习c/c++的50个好网站</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7992217" title="Access violation at address 问题与解决方法">Access violation at address 问题与解决方法</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7969583" title="C++this指针">C++this指针</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7925114" title="回调函数和函数指针调用实现机制及其区别">回调函数和函数指针调用实现机制及其区别</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7924782" title="【Windows API学习】GetProcAddress学习">【Windows API学习】GetProcAddress学习</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7921035" title="【Win32 API学习】RegisterWindowMessage函数">【Win32 API学习】RegisterWindowMessage函数</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/7900808" title="模2运算原理">模2运算原理</a><span>(0)</span>
</li>
<li>
<a href="/dongyue786/article/details/40151127" title="C#编程指南——类的继承、多态性">C#编程指南——类的继承、多态性</a><span>(0)</span>
</li>
</ul>
</div>
<div id="homepageArticles" class="panel tracking-ad" data-mod="popu_4">
<ul class="panel_head"><span>推荐文章</span></ul>
<ul class="panel_body" id="ad_commend">
<ul>
<li><a href="http://blog.csdn.net/blogdevteam/article/details/60576936" target="_blank">* CSDN日报20170306——《程序员转行为什么这么难》</a></li>
<li><a href="http://blog.csdn.net/hejjunlin/article/details/60480109" 
target="_blank">* 直播技术总结（四）音视频数据压缩及编解码基础 </a></li>
<li><a href="http://blog.csdn.net/qibin0506/article/details/60478869"target="_blank">* 第一个PWA程序-聊天室</a></li>
<li><a href="http://blog.csdn.net/cyq1162/article/details/60578454" target="_blank">* 一个想法照进现实-《IT连》创业项目：万事开头难</a></li>
<li><a href="http://blog.csdn.net/jiangwei0910410003/article/details/54879836" 
target="_blank">* Android"挂逼"修炼之行---防自动抢红包外挂原理解析</a></li>


</ul></ul>
</div>


<div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="/dongyue786/article/details/8174813#comments">C#网络编程系列九：类似QQ的即时通信程序</a>
    <p style="margin:0px;"><a href="/baidu_36915386" class="user_name">baidu_36915386</a>:
谢谢！
    </p>
    </li>
    <li>
   
         <a href="/dongyue786/article/details/8174813#comments">C#网络编程系列九：类似QQ的即时通信程序</a>
    <p style="margin:0px;"><a href="/qq_28479307" class="user_name">qq_28479307</a>:
学习
    </p>
    </li>
</ul>
</div>
    </div>
    <div class="clear">
    </div>


                   <!-- 广告位开始 --> 
                    <ins data-revive-zoneid="190" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins> 
                    <!-- 广告位结束 -->

           </div>   

            <div class="clear">
            </div>
        </div>

        

<script type="text/javascript" src="http://c.csdnimg.cn/rabbit/cnick/cnick.js"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script>


<script type="text/javascript" src="http://medal.blog.csdn.net/showblogmedal.ashx?blogid=738663"></script>
<script type="text/javascript" src="http://static.blog.csdn.net/scripts/JavaScript1.js"></script>

    <script type="text/javascript" src="http://passport.csdn.net/content/loginbox/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script>
<script type="text/javascript" src="http://www.csdn.net/ui/scripts/Csdn/counter.js"></script>
<script type="text/javascript" src="http://ad.csdn.net/scripts/ad-blog.js"></script>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<span class='tracking-ad' data-mod='popu_167'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a></span>"
                    + "<span class='tracking-ad' data-mod='popu_170'><a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a></span>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });

        $(".bar").show();
    });
</script>





    </div>
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnId="header_notice_num" wrapId="note1" count="5" subCount="5" type="text/javascript" src="http://c.csdnimg.cn/public/common/toolbar/js/toolbar.js"></script>     <!--new top-->
   
    <link href="http://c.csdnimg.cn/comm_ask/css/ask_float_block.css" type="text/css" rel="stylesheet" />
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/wmd.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/showdown.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/libs/prettify.js'></script>
    <script language='JavaScript' type='text/javascript' src='http://c.csdnimg.cn/comm_ask/js/apps/ask_float_block.js'></script>
   

   

  <div id="a52b5334d" style="width: 1px; height: 1px; display: none;">
                    <script id="adJs52b5334"></script>
                    <script>document.getElementById("adJs52b5334").src = "http://ads.csdn.net/js/opt/52b5334.js?t=" + Math.random();</script>
   </div>

    <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_code.css" />
    <script type="text/javascript" src="http://static.blog.csdn.net/scripts/saveToCode.js"></script>
      <script type="text/javascript" src="//csdnimg.cn/rabbit/tracking-ad/main.js?75eacd8"></script>

     <link rel="stylesheet" href="http://static.blog.csdn.net/css/fa.css" />

    <div class="pop_CA_cover"  style="display:none"></div>
    <div class="pop pop_CA"  style="display:none">
          <div class="CA_header">
            收藏助手
            <span class="cancel_icon"  id="fapancle"  onclick="$('.pop_CA').hide();$('.pop_CA_cover').hide();"></span>
          </div>
          <iframe src="" id="fa" frameborder="0" width="100%" height="360"  scrolling="no" />
    </div>
</body>
</html>   
 